home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000…tember: Reference Library / Dev.CD Sep 00 RL Disk 1.toast / mac / Technical Documentation / Develop / develop Issue 28 / develop Issue 28 code / MacApp Debugging / TwistDownLists / UTwistDownApp.h < prev    next >
Encoding:
Text File  |  1996-07-15  |  9.3 KB  |  255 lines  |  [TEXT/MPS ]

  1. //----------------------------------------------------------------------------------------
  2. // UTwistDownApp.h
  3. // ETO20 MacApp 3.3.1, MPW 3.4.1
  4. // Copyright ©1994-1996 Conrad Kopala
  5. // Twist Down Lists version 2.0a0 7/15/96
  6. //----------------------------------------------------------------------------------------
  7.  
  8. #ifndef __UTWISTDOWNAPP__
  9. #define __UTWISTDOWNAPP__
  10.  
  11. #ifndef __UVOLUMEBASEDAPP__
  12. #include "UVolumeBasedApp.h"
  13. #endif
  14.  
  15. #ifndef __UVOLUME__
  16. #include "UVolume.h"
  17. #endif
  18.  
  19. #ifndef __UTWISTDOWNGLOBALS__
  20. #include "UTwistDownGlobals.h"    //Required for EAppleEventRouting
  21. #endif
  22.  
  23. //MacApp stuff
  24. #ifndef __UAPPLICATION__
  25. #include "UApplication.h"
  26. #endif
  27.  
  28. #ifndef __ULIST__
  29. #include "UList.h"
  30. #endif
  31.  
  32. #ifndef __ULISTITERATOR__
  33. #include "UListIterator.h"
  34. #endif
  35.  
  36. #ifndef __UMACAPPGLOBALS__
  37. #include "UMacAppGlobals.h"
  38. #endif
  39.  
  40. #ifndef __UCOMMAND__
  41. #include "UCommand.h"
  42. #endif
  43.  
  44. //ToolBox stuff
  45. #ifndef __QUICKDRAW__
  46. #include "Quickdraw.h"
  47. #endif
  48.  
  49. //ANSI stuff
  50. //None
  51. //----------------------------------------------------------------------------------------
  52. // Forward and external classes
  53. //----------------------------------------------------------------------------------------
  54. class TWindow;                        //external
  55. class TTwistDownApp;            //forward - required because CWindowsMenuListIterator uses it
  56. class TTwistDownElement;    //external
  57.  
  58. #if qDebug
  59. class TResetObjectCountCommand;    //forward
  60. #endif
  61. //----------------------------------------------------------------------------------------
  62. // CWindowsMenuListIterator
  63. //----------------------------------------------------------------------------------------
  64. class CWindowsMenuListIterator : public CObjectIterator
  65. {
  66. public:
  67.     CWindowsMenuListIterator::CWindowsMenuListIterator(TTwistDownApp* itsApplication,
  68.                       ArrayIndex itsLowBound, ArrayIndex itsHighBound,
  69.                       Boolean itsForward);
  70.  
  71.     CWindowsMenuListIterator::CWindowsMenuListIterator(TTwistDownApp* itsApplication, Boolean itsForward);
  72.  
  73.     CWindowsMenuListIterator::CWindowsMenuListIterator(TTwistDownApp* itsApplication);
  74.     
  75.     virtual ~CWindowsMenuListIterator();
  76.     
  77.     TWindow* CWindowsMenuListIterator::CurrentWindow();
  78.         // returns the current Window
  79.     
  80.     TWindow* CWindowsMenuListIterator::FirstWindow();
  81.         // return the first Window in the iteration
  82.  
  83.     TWindow* CWindowsMenuListIterator::NextWindow();
  84.         // advances the iteration and then returns the Window
  85. };
  86. //----------------------------------------------------------------------------------------
  87. // TVolumesCommand: Retrieves a list of Volumes from an AppleEvent Abstract class for
  88. // TOVolumeCommand.    Analog of TFilesCommand.
  89. //----------------------------------------------------------------------------------------
  90. class TVolumesCommand : public TServerCommand
  91. {
  92.     MA_DECLARE_CLASS;
  93.     
  94. public:
  95. TList* fVolumeList;
  96.     
  97. TVolumesCommand::TVolumesCommand();        
  98. virtual ~TVolumesCommand();
  99. void TVolumesCommand::IVolumesCommand(CommandNumber itsCommandNumber, TList* theDocuments);
  100. void TVolumesCommand::IVolumesCommand(CommandNumber itsCommandNumber, const AppleEvent& itsMessage, 
  101.                                                                             const AppleEvent& itsReply);
  102. void TVolumesCommand::GetVolumesList();
  103. };
  104. //----------------------------------------------------------------------------------------
  105. // TOVolumeCommand: Accepts a list of volume aliases and opens each of them
  106. //    Analog of TODocCommand.
  107. //----------------------------------------------------------------------------------------
  108. class TOVolumeCommand : public TVolumesCommand
  109. {
  110.     MA_DECLARE_CLASS;
  111.     
  112. public:
  113. TOVolumeCommand::TOVolumeCommand();
  114. virtual ~TOVolumeCommand();        
  115. void TOVolumeCommand::IOVolumeCommand(CommandNumber itsCommandNumber, TList* theDocuments);        
  116. void TOVolumeCommand::IOVolumeCommand(CommandNumber itsCommandNumber, const AppleEvent& itsMessage, 
  117.                                                                             const AppleEvent& itsReply);
  118. virtual void TOVolumeCommand::DoIt();
  119. virtual TAppleEvent* TOVolumeCommand::MakeAppleEvent();
  120. };
  121. //----------------------------------------------------------------------------------------
  122. // TOpenVolumeCommand: Accepts a single instance of TVolume and opens it.
  123. //    Analog of TODocCommand. - old version, not used
  124. //----------------------------------------------------------------------------------------
  125. class TOpenVolumeCommand : public TCommand
  126. {
  127.     MA_DECLARE_CLASS;
  128.     
  129. public:
  130. TVolume* fVolume;
  131.  
  132. TOpenVolumeCommand::TOpenVolumeCommand();
  133. virtual ~TOpenVolumeCommand();        
  134. void TOpenVolumeCommand::IOpenVolumeCommand(CommandNumber itsCommandNumber, TVolume* aVolume);
  135. virtual void TOpenVolumeCommand::DoIt();
  136. };
  137.  
  138.  
  139. #if qDebug
  140. //----------------------------------------------------------------------------------------
  141. // TResetObjectCountCommand:
  142. //----------------------------------------------------------------------------------------
  143. class TResetObjectCountCommand : public TServerCommand
  144. {
  145.     MA_DECLARE_CLASS;
  146.     
  147. public:
  148.  
  149. TResetObjectCountCommand::TResetObjectCountCommand();        
  150. virtual ~TResetObjectCountCommand();
  151. void TResetObjectCountCommand::IResetObjectCountCommand();
  152. void TResetObjectCountCommand::IResetObjectCountCommand(const AppleEvent& itsMessage, const AppleEvent& itsReply);
  153. virtual TAppleEvent* TResetObjectCountCommand::MakeAppleEvent();
  154. virtual void TResetObjectCountCommand::DoIt();
  155. };
  156. #endif
  157.  
  158. //----------------------------------------------------------------------------------------
  159. // TSplashScreenCommand:
  160. //----------------------------------------------------------------------------------------
  161. class TSplashScreenCommand : public TCommand
  162. {
  163.     MA_DECLARE_CLASS;
  164.     
  165. public:
  166. TWindow* fSplashScreenWindow;
  167.  
  168. TSplashScreenCommand::TSplashScreenCommand();
  169. virtual ~TSplashScreenCommand();        
  170. void TSplashScreenCommand::ISplashScreenCommand(CommandNumber itsCommandNumber);        
  171. virtual void TSplashScreenCommand::DoIt();
  172. };
  173.  
  174.  
  175. //----------------------------------------------------------------------------------------
  176. // TTwistDownApp
  177. //----------------------------------------------------------------------------------------
  178. class TTwistDownApp: public TApplication, public MVolumeBasedApp
  179. {
  180.     MA_DECLARE_CLASS;
  181.     
  182. public:
  183. Boolean fHasSplashScreen;
  184. TList* fWindowsMenuList;        
  185. Boolean fShowInvisibleFiles;
  186. Boolean fAllowUnlimitedDocs;
  187.  
  188. //The following fields are used to manage memory.
  189. short fTDElementClassSize;    //the class size of TTwistDownElement
  190. short fTDControlClassSize;    //the class size of TTwistDownControl
  191.  
  192. TTwistDownApp::TTwistDownApp();
  193. virtual ~TTwistDownApp();
  194. virtual void TTwistDownApp::ITwistDownApp(Boolean hasSplashScreen);
  195.  
  196. //This application is distinctly un-Mac-like because the same volume can be opened repeatedly by
  197. //setting fAllowUnlimitedDocs = TRUE which can be done by exercising the menu command 
  198. //cAllowUnlimitedDocs. Since TTwistDownDocument is never saved, that is not a problem. 
  199. //From a debugging point of view it is convenient to be able to repeatedly open the same test disk. 
  200. //But then, the items in the Windows menu all have the same name which can be confusing. 
  201. //Therefore, volumes with the same name get numbered so you can tell which is which. 
  202. //The following method helps by scanning the document list and returning a count of the number 
  203. //of documents with the same name plus one, ie. the next document number. By the way, scripting 
  204. //support requires that documents have unique names. GetNextDocumentNumber is called by 
  205. //TTwistDownDocument::SetVolumeData.
  206.  
  207. short TTwistDownApp::GetNextDocumentNumber(const CStr31& volumeName);
  208.  
  209. TDocument* TTwistDownApp::FindDocument(TVolume* aVolume);    //overloaded    
  210. TDocument* TTwistDownApp::DoMakeDocument(CommandNumber aCommandNumber, TVolume* itsVolume);    //overloaded        
  211.  
  212. virtual void TTwistDownApp::DoSetupMenus();    
  213. virtual void TTwistDownApp::DoMenuCommand(CommandNumber aCommandNumber);
  214.     
  215. //these add and delete windows to/from fWindowsMenuList
  216. //they are called by whoever opens/closes windows
  217. void     TTwistDownApp::AddWindowToWindowsMenuList(TWindow* windowToAdd);
  218. void     TTwistDownApp::RemoveWindowFromWindowsMenuList(TWindow* windowToRemove);
  219. short TTwistDownApp::CountWindowsInList();
  220.  
  221. TWindow* TTwistDownApp::DoMakeSplashScreen();
  222.  
  223. TWindow* TTwistDownApp::DoMakeAboutBox();
  224. virtual void TTwistDownApp::DoAboutBox();
  225.  
  226. virtual void TTwistDownApp::GetStandardFileParameters(CommandNumber itsCommandNumber, ProcPtr& fileFilter,
  227.                                            TypeListHandle& typeList, short& dlgID,CPoint& where,ProcPtr& dlgHook,
  228.                                            ProcPtr& modalFilter,Ptr& activeList,ProcPtr& activateProc,
  229.                                            StandardFileReply* reply,void*& yourDataPtr);        
  230.  
  231. virtual void TTwistDownApp::DoOpen(CommandNumber theCmdNumber);
  232.  
  233. //Scripting Support
  234. virtual void TTwistDownApp::DoScriptCommand(CommandNumber aCommandNumber, TAppleEvent* message, TAppleEvent* reply);
  235. virtual long TTwistDownApp::CountContainedObjects(DescType desiredType);
  236. virtual MScriptableObject* TTwistDownApp::GetContainedObject(DescType desiredType,
  237.                                               DescType selectionForm, const CAEDesc& selectionData);
  238.  
  239. virtual void TTwistDownApp::SetObjectProperty(const CAEDesc& thePropertyValue,DescType whichProperty);
  240.  
  241. virtual void TTwistDownApp::GetSetPropertyInfo(DescType whichProperty,CommandNumber& cmdNum,Boolean& canUndo,
  242.                                                             Boolean& causesChange,TCommandHandler* &theContext);
  243.  
  244. virtual Boolean TTwistDownApp::GetObjectProperty(CAEDesc& thePropertyValue,
  245.                                       DescType whichProperty,const CAEDesc& desiredType);
  246.                                         
  247. };    
  248. //----------------------------------------------------------------------------------------
  249. // Globals defined by this unit
  250. //----------------------------------------------------------------------------------------
  251.  
  252. extern TTwistDownApp* gTwistDownApp;
  253.  
  254. #endif
  255.